<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" href="<c:url value="/resources/styles/springsource.css"/>" type="text/css"/>
	<title><spring:message code="account.details.title"/></title>
</head>

<body>
<div id="main_wrapper">

<table>
	<tr><td><h2><spring:message code="account.details.title"/></h2></td>
		<td>
			<security:authorize ifAllGranted="ROLE_ADMIN">
			 	<a class="hlinks" href="${flowExecutionUrl}&_eventId=editAccountDetails&entityId=${account.entityId}">
					<spring:message code="account.details.edit"/>
				</a>
			</security:authorize>
		</td>
		<td><a class="hlinks" href="${flowExecutionUrl}&_eventId=newSearch"><spring:message code="account.details.search.again"/></a>
		</td>
	</tr>
	<tr><td>
		<table>
			<tr>
				<td><spring:message code="account.details.contact.number"/></td>
				<td>${account.contactNumber}</td>
			</tr>
			<tr>
				<td><spring:message code="account.details.customer.name"/></td>
				<td>${account.name}</td>
			</tr>
			<tr>
				<td><spring:message code="account.details.credit.card.number"/></td>
				<td>${account.creditCardNumber}</td>
			</tr>
		</table>
	</td></tr>
	<security:authorize ifAllGranted="ROLE_ADMIN">
		<tr><td>
			<table>
				<thead>
					<tr>
						<td><spring:message code="account.details.benefeciaries"/></td>
					</tr>
					<tr>
						<td><spring:message code="account.details.benefeciaries.name"/></td>
						<td><spring:message code="account.details.benefeciaries.allocation"/></td>
						<td><spring:message code="account.details.benefeciaries.savings"/></td>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${account.beneficiaries}" var="beneficiary">
						<tr>
							<td>${beneficiary.name}</td>
							<td>${beneficiary.allocationPercentage}</td>
							<td>${beneficiary.savings}</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</td></tr>
	</security:authorize>
	
</table>
</div>
</body>

</html>
